import React, { Component } from 'react'
import { connect } from 'react-redux'
import { increment } from './redux/actions/countAction'

export class App extends Component {
  render() {
    console.log(this.props)
    let { count } = this.props
    return (
      <div>
        现在数字为{count}
        <button onClick={this.add}>点我执行action</button>
      </div>
    )
  }
  add = () => {
    this.props.increment(1)
  }
}

const mapStateToProps = (state) => ({
  count: state.count,
})

const mapDispatchToProps = {
  increment,
}

export default connect(mapStateToProps, mapDispatchToProps)(App)
